package com.sinaapp.mjfinal.mvc.controller;

import java.util.List;

import com.jfinal.plugin.activerecord.Record;
import com.sinaapp.mjfinal.mvc.base.BaseController;
import com.sinaapp.mjfinal.mvc.model.Population;
import com.sinaapp.mjfinal.mvc.service.PopulationService;
import com.sinaapp.mjfinal.mvc.service.TmallMobileService;
/**
 * 可视化控制器
 * @author binchao
 * 2016年2月27日
 */
public class VisController extends BaseController {
	
	/**
	 * 可视化首页
	 */
	public void index() {
		List<Population> populations = PopulationService.service.findAll(); //人口数据统计表
		String popOptionJson = PopulationService.service.getPopulationForEchartsOption();  //人口数据echarts option
		String tmallMobile = TmallMobileService.service.wordCloud(); //天猫手机数据词云
		List<Record> top10 = TmallMobileService.service.top10(); //手机销量前十
		setAttr("populations", populations);
		setAttr("popOptionJson", popOptionJson);
		setAttr("tmallMobile", tmallMobile);
		setAttr("top10", top10);
		
		render("index.html");
	}
}
